#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QGraphicsBlurEffect>
#include <QNetworkAccessManager>
#include <QGraphicsPixmapItem>
#include <QNetworkReply>
#include <QTextCodec>
#include <QUrl>
#include <QSlider>
#include <QList>
#include <QListWidgetItem>
#include <QDebug>
#include <QtConcurrent/QtConcurrent>
#include <QFile>
#include <QDir>
#include <QIcon>
#include <QMessageBox>
#include <QMouseEvent>
#include <QProcess>
#include <QJsonDocument>
#include <QMediaPlayer>
#include <QByteArray>
#include <QJsonParseError>
#include <QJsonObject>
#include <QMediaPlayer>
#include "bilibutton.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QtConcurrent::run([=](){
        QProcess *a=new QProcess(this);
        a->start("rm -rf "+QDir::homePath()+"/.cache/bili/*");
        a->waitForFinished();
    });
    ui->listWidget->setSelectionMode(QListWidget::SingleSelection);
    ui->listWidget->setViewMode(QListWidget::IconMode);
    ui->listWidget->setIconSize(QSize(160,90));
    ui->BVlist->hide();
    //ui->listWidget->setResizeMode(QListWidget::Adjust);
    ui->listWidget->setSpacing(10);
    this->setAttribute(Qt::WA_TranslucentBackground);
    this->setWindowFlags(Qt::FramelessWindowHint);
    Blur("/home/qygw/1.jpg");
    showMainPage();
    connect(ui->face1, &biliButton::clicked, this, &MainWindow::ChooseVideoButton);
    connect(ui->face2, &biliButton::clicked, this, &MainWindow::ChooseVideoButton2);
    connect(ui->face3, &biliButton::clicked, this, &MainWindow::ChooseVideoButton3);
    connect(ui->face4, &biliButton::clicked, this, &MainWindow::ChooseVideoButton4);
    connect(ui->face5, &biliButton::clicked, this, &MainWindow::ChooseVideoButton5);
    connect(ui->face6, &biliButton::clicked, this, &MainWindow::ChooseVideoButton6);
    connect(ui->face7, &biliButton::clicked, this, &MainWindow::ChooseVideoButton7);
    connect(ui->face8, &biliButton::clicked, this, &MainWindow::ChooseVideoButton8);
    connect(ui->face9, &biliButton::clicked, this, &MainWindow::ChooseVideoButton9);
    connect(ui->face10, &biliButton::clicked, this, &MainWindow::ChooseVideoButton10);
    connect(ui->face11, &biliButton::clicked, this, &MainWindow::ChooseVideoButton11);
    connect(ui->face12, &biliButton::clicked, this, &MainWindow::ChooseVideoButton12);
    connect(ui->face13, &biliButton::clicked, this, &MainWindow::ChooseVideoButton13);
    connect(ui->face14, &biliButton::clicked, this, &MainWindow::ChooseVideoButton14);
    connect(ui->face15, &biliButton::clicked, this, &MainWindow::ChooseVideoButton15);
    connect(ui->face16, &biliButton::clicked, this, &MainWindow::ChooseVideoButton16);
    connect(ui->face17, &biliButton::clicked, this, &MainWindow::ChooseVideoButton17);
    connect(ui->face18, &biliButton::clicked, this, &MainWindow::ChooseVideoButton18);
    connect(ui->face19, &biliButton::clicked, this, &MainWindow::ChooseVideoButton19);
    connect(ui->face20, &biliButton::clicked, this, &MainWindow::ChooseVideoButton20);
    left_list[0]=ui->toolButton_2;
    left_list[1]=ui->toolButton_3;
    left_list[2]=ui->toolButton_4;
    for (int i=0;i<3;i++)
    {
        left_list[i]->setStyleSheet("background-color: rgba(255, 255, 255, 0);color:#000000;border-radius:10px");
    }
    left_list[0]->setStyleSheet("color:#FFFFFF;background-color:#b1d3f1;border-radius:10px");
    LoadMainPageInfor();
}

MainWindow::~MainWindow()
{
    delete ui;
}
void MainWindow::Blur(QString Path)
{
    m_blurValue=0;
        ui->graphicsView->setAlignment(Qt::AlignCenter | Qt::AlignCenter);//这里是左上角方式显示
        ui->graphicsView->setSceneRect(801, 600, 200, 200);
        ui->graphicsView->setScene(myscene);
        ui->face1->setScaledContents(true);
        ui->face2->setScaledContents(true);
        ui->face3->setScaledContents(true);
        ui->face4->setScaledContents(true);
        ui->face5->setScaledContents(true);
        ui->face6->setScaledContents(true);
        ui->face7->setScaledContents(true);
        ui->face8->setScaledContents(true);
        ui->face9->setScaledContents(true);
        ui->face10->setScaledContents(true);
        ui->face11->setScaledContents(true);
        ui->face12->setScaledContents(true);
        ui->face13->setScaledContents(true);
        ui->face14->setScaledContents(true);
        ui->face15->setScaledContents(true);
        ui->face16->setScaledContents(true);
        ui->face17->setScaledContents(true);
        ui->face18->setScaledContents(true);
        ui->face19->setScaledContents(true);
        ui->face20->setScaledContents(true);
        ui->graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        ui->graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        Graitem=new QGraphicsPixmapItem(QPixmap(Path));
        ui->graphicsView->scene()->addItem(Graitem);
        //item->setFlags(QGraphicsItem::ItemIsMovable|QGraphicsItem::ItemIsSelectable);
        blurEffect=new QGraphicsBlurEffect;
        blurEffect->setBlurRadius(m_blurValue);
        Graitem->setGraphicsEffect(blurEffect);
        for (int a=0;a<20;a++)
        {
            blurEffect->setBlurRadius(m_blurValue++);
        }
}

void MainWindow::on_pushButton_2_clicked(bool checked)
{
    this->showMinimized();
}
void MainWindow::getMainPageTitle()
{
    QProcess *readJson=new QProcess(this);
    readJson->start("sh readJson title");
    readJson->waitForFinished();
    QString text=QString::fromUtf8(readJson->readAllStandardOutput());
    qDebug()<<text;
    MainTitlelist = text.split("\n");
    ui->title1->setText(MainTitlelist[0]);
    ui->title2->setText(MainTitlelist[1]);
    ui->title3->setText(MainTitlelist[2]);
    ui->title4->setText(MainTitlelist[3]);
    ui->title5->setText(MainTitlelist[4]);
    ui->title6->setText(MainTitlelist[5]);
    ui->title7->setText(MainTitlelist[6]);
    ui->title8->setText(MainTitlelist[7]);
    ui->title9->setText(MainTitlelist[8]);
    ui->title10->setText(MainTitlelist[9]);
    readJson->close();
}
void MainWindow::getMainPageFaces()
{
    QProcess *readJson=new QProcess(this);
    readJson->start("sh readJson pic");
    readJson->waitForFinished();
    QString text=QString::fromUtf8(readJson->readAllStandardOutput());
    MainFacelist = text.split("\n");
    QtConcurrent::run([=](){
        ui->face1->setPixmap(QPixmap(""));
        ui->face2->setPixmap(QPixmap(""));
        ui->face3->setPixmap(QPixmap(""));
        ui->face4->setPixmap(QPixmap(""));
        ui->face5->setPixmap(QPixmap(""));
        ui->face6->setPixmap(QPixmap(""));
        ui->face7->setPixmap(QPixmap(""));
        ui->face8->setPixmap(QPixmap(""));
        ui->face9->setPixmap(QPixmap(""));
        ui->face10->setPixmap(QPixmap(""));
        QProcess *getFace=new QProcess(this);
        getFace->start("wget "+MainFacelist[0]+" -O 1.jpg");
        getFace->waitForFinished();
        ui->face1->setPixmap(QPixmap("1.jpg"));
        getFace->start("wget "+MainFacelist[1]+" -O 2.jpg");
        getFace->waitForFinished();
        ui->face2->setPixmap(QPixmap("2.jpg"));
        getFace->start("wget "+MainFacelist[2]+" -O 3.jpg");
        getFace->waitForFinished();
        ui->face3->setPixmap(QPixmap("3.jpg"));
        getFace->start("wget "+MainFacelist[3]+" -O 4.jpg");
        getFace->waitForFinished();
        ui->face4->setPixmap(QPixmap("4.jpg"));
        getFace->start("wget "+MainFacelist[4]+" -O 5.jpg");
        getFace->waitForFinished();
        ui->face5->setPixmap(QPixmap("5.jpg"));
        getFace->start("wget "+MainFacelist[5]+" -O 6.jpg");
        getFace->waitForFinished();
        ui->face6->setPixmap(QPixmap("6.jpg"));
        getFace->start("wget "+MainFacelist[6]+" -O 7.jpg");
        getFace->waitForFinished();
        ui->face7->setPixmap(QPixmap("7.jpg"));
        getFace->start("wget "+MainFacelist[7]+" -O 8.jpg");
        getFace->waitForFinished();
        ui->face8->setPixmap(QPixmap("8.jpg"));
        getFace->start("wget "+MainFacelist[8]+" -O 9.jpg");
        getFace->waitForFinished();
        ui->face9->setPixmap(QPixmap("9.jpg"));
        getFace->start("wget "+MainFacelist[9]+" -O 10.jpg");
        getFace->waitForFinished();
        ui->face10->setPixmap(QPixmap("10.jpg"));
    });
    readJson->close();
}

void MainWindow::getMainPageBV()
{
    QProcess *readJson=new QProcess(this);
    readJson->start("sh readJson bvid");
    readJson->waitForFinished();
    QString text=QString::fromUtf8(readJson->readAllStandardOutput());
    MainPageBvLIst = text.split("\n");
    readJson->close();
}

void MainWindow::getMainPageJson()
{
    QProcess *read=new QProcess(this);
    read->start("rm -rf json.txt");
    read->waitForFinished();
    read->start("sh getJson");
    read->waitForFinished();
    read->close();
}
void MainWindow::LoadMainPageInfor()
{
    getMainPageJson();
    getMainPageTitle();
    getMainPageFaces();
    getMainPageBV();
}
void MainWindow::ChooseButton(int index)
{
    for (int i=0;i<3;i++)
    {
        left_list[i]->setStyleSheet("background-color: rgba(255, 255, 255, 0);color:#000000;border-radius:10px");
    }
    left_list[index]->setStyleSheet("color:#FFFFFF;background-color:#b1d3f1;border-radius:10px");
}

void MainWindow::on_toolButton_2_clicked(bool checked)
{
    ChooseButton(0);
    showMainPage();
}

void MainWindow::on_toolButton_3_clicked(bool checked)
{
    ChooseButton(1);
    showHistoryPage();
}

void MainWindow::on_toolButton_4_clicked(bool checked)
{
    ChooseButton(2);
}
void MainWindow::ChooseVideoButton()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[0];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    qDebug()<<search;
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[0]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget https:"+SearchedFaceList[10]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[0]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[10]);
        }
    }
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[0]+","+MainPageBvLIst[0]);
    item->setIcon(QPixmap(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[0]);
    getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[10]);
            getFace->waitForFinished();
        }
    }
    //player->waitForFinished();
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton2()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[1];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[1]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget https:"+SearchedFaceList[11]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[1]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[11]);
        }
    }
    ui->BVlist->addItem(tem);
    picNum++;
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[1]+","+MainPageBvLIst[1]);
    ui->listWidget->addItem(item);
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[1]);
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[11]);
        }
    }
}
void MainWindow::ChooseVideoButton3()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[2];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[2]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget https:"+SearchedFaceList[12]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[2]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[12]);
        }
    }
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[2]+","+MainPageBvLIst[2]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[2]);
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[12]);
        }
    }
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton4()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[3];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[3]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget https:"+SearchedFaceList[13]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[3]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[13]);
        }
    }
    ui->BVlist->addItem(tem);
    getFace->close();
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[3]+","+MainPageBvLIst[3]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[3]);
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[13]);
        }
    }
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton5()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[4];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[4]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget https:"+SearchedFaceList[14]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[4]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[14]);
        }
    }
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[4]);
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[14]);
        }
    }
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton6()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[5];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[5]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget https:"+SearchedFaceList[15]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[5]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[15]);
        }
    }
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[5]+","+MainPageBvLIst[5]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[5]);
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[15]);
        }
    }
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton7()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[6];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[6]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget https:"+SearchedFaceList[16]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[6]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[16]);
        }
    }
    ui->BVlist->addItem(tem);
    getFace->close();
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[6]+","+MainPageBvLIst[6]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[6]);
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[16]);
        }
    }
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton8()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[7];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[7]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget https:"+SearchedFaceList[17]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[2]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[17]);
        }
    }
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[7]+","+MainPageBvLIst[7]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[7]);
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[17]);
        }
    }
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton9()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[8];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[8]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget https:"+SearchedFaceList[18]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[8]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[18]);
        }
    }
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[8]+","+MainPageBvLIst[8]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[8]);
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[18]);
        }
    }
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton10()
{
    player->close();
    QProcess *player = new QProcess(this);
    qDebug()<<MainPageBvLIst[9];
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    if (search==0)
    {
    getFace->start("wget "+MainFacelist[9]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    //getFace->waitForFinished();
    }
    else
    {
        if (search==1)
        {
            getFace->start("wget "+SearchedBVList[19]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
            getFace->waitForFinished();
        }
    }
    QListWidgetItem*tem=new QListWidgetItem;
    if (search==0)
    {
    tem->setText(MainPageBvLIst[9]);
    }
    else
    {
        if (search==1)
        {
            tem->setText(SearchedBVList[19]);
        }
    }
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[9]+";"+MainPageBvLIst[9]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    if (search==0)
    {
    player->start("mpv https://www.bilibili.com/video/"+MainPageBvLIst[9]);
    }
    else
    {
        if (search==1)
        {
            player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[19]);
        }
    }
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton11()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[0]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[0]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[0]);

    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton12()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[1]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[1]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[1]);
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton13()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[2]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[2]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[2]);
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton14()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[3]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[3]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[3]);
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton15()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[4]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[4]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[4]);
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton16()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[5]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[5]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[5]);
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton17()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[6]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[6]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[6]);
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton18()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[7]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[7]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[7]);
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton19()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[8]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[8]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[8]);
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::ChooseVideoButton20()
{
    player->close();
    QProcess *player = new QProcess(this);
    QProcess *getFace=new QProcess(this);
    QString number=QString("%1").arg(picNum);
    getFace->start("wget https:"+SearchedFaceList[9]+" -O "+QDir::homePath()+"/.cache/bili/"+number+".jpg");
    getFace->waitForFinished();
    getFace->close();
    QListWidgetItem*tem=new QListWidgetItem;
    tem->setText(SearchedBVList[9]);
    ui->BVlist->addItem(tem);
    QListWidgetItem*item=new QListWidgetItem;
    //item->setText(MainTitlelist[4]+","+MainPageBvLIst[4]);
    item->setIcon(QIcon(QDir::homePath()+"/.cache/bili/"+number+".jpg"));
    ui->listWidget->addItem(item);
    picNum++;
    qDebug()<<picNum<<endl;
    player->start("mpv https://www.bilibili.com/video/"+SearchedBVList[9]);
    //QMessageBox::information(NULL,"单击","单击了我",QMessageBox::Yes);
}
void MainWindow::showHistoryPage()
{
    ui->face1->hide();
    ui->face2->hide();
    ui->face3->hide();
    ui->face4->hide();
    ui->face5->hide();
    ui->face6->hide();
    ui->face7->hide();
    ui->face8->hide();
    ui->face9->hide();
    ui->face10->hide();
    ui->title1->hide();
    ui->title2->hide();
    ui->title3->hide();
    ui->title4->hide();
    ui->title5->hide();
    ui->title6->hide();
    ui->title7->hide();
    ui->title8->hide();
    ui->title9->hide();
    ui->face11->hide();
    ui->face12->hide();
    ui->face13->hide();
    ui->face14->hide();
    ui->face15->hide();
    ui->face16->hide();
    ui->face17->hide();
    ui->face18->hide();
    ui->face19->hide();
    ui->face20->hide();
    ui->title11->hide();
    ui->title12->hide();
    ui->title13->hide();
    ui->title14->hide();
    ui->title15->hide();
    ui->title16->hide();
    ui->title17->hide();
    ui->title18->hide();
    ui->title19->hide();
    ui->title20->hide();
    ui->gotoNextPage->hide();
    ui->gotoLastPage->hide();
    ui->title10->hide();
    ui->replace->hide();
    ui->MainPic->hide();
    ui->cancelSearch->hide();
    ui->listWidget->show();
    ui->playSelected->show();
    ui->DelectAll->show();
    ui->DeleteSelected->show();
    search=0;
}
void MainWindow::showMainPage()
{
    ui->face1->show();
    ui->face2->show();
    ui->face3->show();
    ui->face4->show();
    ui->face5->show();
    ui->face6->show();
    ui->face7->show();
    ui->face8->show();
    ui->face9->show();
    ui->face10->show();
    ui->title1->show();
    ui->title2->show();
    ui->title3->show();
    ui->title4->show();
    ui->title5->show();
    ui->title6->show();
    ui->title7->show();
    ui->title8->show();
    ui->title9->show();
    ui->title10->show();
    ui->replace->show();
    ui->MainPic->show();
    ui->gotoNextPage->hide();
    ui->gotoLastPage->hide();
    ui->cancelSearch->hide();
    ui->listWidget->hide();
    ui->playSelected->hide();
    ui->DeleteSelected->hide();
    ui->DelectAll->hide();
    ui->face11->hide();
    ui->face12->hide();
    ui->face13->hide();
    ui->face14->hide();
    ui->face15->hide();
    ui->face16->hide();
    ui->face17->hide();
    ui->face18->hide();
    ui->face19->hide();
    ui->face20->hide();
    ui->title11->hide();
    ui->title12->hide();
    ui->title13->hide();
    ui->title14->hide();
    ui->title15->hide();
    ui->title16->hide();
    ui->title17->hide();
    ui->title18->hide();
    ui->title19->hide();
    ui->title20->hide();
    search=0;
    LoadMainPageInfor();
}
void MainWindow::doubleclicked(QListWidgetItem* item)

{

    QMessageBox::information(this,"双击消息","双击"+item->text());

}

void MainWindow::on_replace_clicked(bool checked)
{
    LoadMainPageInfor();
}

void MainWindow::on_playSelected_clicked(bool checked)
{
    player->close();
    int Row;
    Row=ui->listWidget->currentRow();
    QString BV=ui->BVlist->takeItem(Row)->text();
        qDebug()<<BV<<endl;
        QListWidgetItem*tem=new QListWidgetItem;
        tem->setText(BV);
        ui->BVlist->insertItem(Row,tem);
        QProcess *player = new QProcess(this);
        player->start("mpv https://www.bilibili.com/video/"+BV);
}

void MainWindow::on_pushButton_3_clicked(bool checked)
{
    if (ui->lineEdit->text()=="")
    {
        QMessageBox::information(NULL,"错误！","您并没有输入搜索词。",QMessageBox::Yes);
        search=0;
    }
    else
    {
        ReloadSearched(SearchPage);
    }
}
void MainWindow::GotoSearchPage()
{
    ui->face1->show();
    ui->face2->show();
    ui->face3->show();
    ui->face4->show();
    ui->face5->show();
    ui->face6->show();
    ui->face7->show();
    ui->face8->show();
    ui->face9->show();
    ui->face10->show();
    ui->title1->show();
    ui->title2->show();
    ui->title3->show();
    ui->title4->show();
    ui->title5->show();
    ui->title6->show();
    ui->title7->show();
    ui->title8->show();
    ui->title9->show();
    ui->title10->show();
    ui->face11->show();
    ui->face12->show();
    ui->face13->show();
    ui->face14->show();
    ui->face15->show();
    ui->face16->show();
    ui->face17->show();
    ui->face18->show();
    ui->face19->show();
    ui->face20->show();
    ui->title11->show();
    ui->title12->show();
    ui->title13->show();
    ui->title14->show();
    ui->title15->show();
    ui->title16->show();
    ui->title17->show();
    ui->title18->show();
    ui->title19->show();
    ui->title20->show();
    ui->replace->hide();
    ui->MainPic->hide();
    ui->listWidget->hide();
    ui->playSelected->hide();
    ui->DeleteSelected->hide();
    ui->DelectAll->hide();
    ui->gotoNextPage->show();
    ui->gotoLastPage->show();
    ui->listWidget->hide();
    ui->BVlist->hide();
    ui->cancelSearch->show();
}

void MainWindow::on_cancelSearch_clicked(bool checked)
{
    ui->lineEdit->setText("");
    search=0;
    LoadMainPageInfor();
    showMainPage();
    ChooseButton(0);
}

void MainWindow::on_DeleteSelected_clicked(bool checked)
{
    QListWidgetItem *DeleteBV = ui->BVlist->takeItem(ui->listWidget->currentRow());
    delete DeleteBV;
    QListWidgetItem *Delecteditem = ui->listWidget->takeItem(ui->listWidget->currentRow());
    delete Delecteditem;
    QProcess *deleteFace=new QProcess(this);
    picNum--;
    qDebug()<<picNum;
}

void MainWindow::on_DelectAll_clicked(bool checked)
{
    ui->listWidget->clear();
    ui->BVlist->clear();
    picNum=0;
    qDebug()<<picNum;
}
void MainWindow::GetSearchedText(QString key, int page)
{
    QProcess *getText=new QProcess(this);
    QString Page=QString("%1").arg(page);
    QString a="sh Search "+key.simplified()+" "+Page+" title";
    qDebug()<<a;
    getText->start(a);
    getText->waitForFinished();
    QString SearchedText=getText->readAllStandardOutput();
    qDebug()<<SearchedText;
    SearchedTextList = SearchedText.split("\n");
    qDebug()<<SearchedTextList[0]<<endl;
    ui->title11->setText(SearchedTextList[0]);
    ui->title12->setText(SearchedTextList[1]);
    ui->title13->setText(SearchedTextList[2]);
    ui->title14->setText(SearchedTextList[3]);
    ui->title15->setText(SearchedTextList[4]);
    ui->title16->setText(SearchedTextList[5]);
    ui->title17->setText(SearchedTextList[6]);
    ui->title18->setText(SearchedTextList[7]);
    ui->title19->setText(SearchedTextList[8]);
    ui->title20->setText(SearchedTextList[9]);
    ui->title1->setText(SearchedTextList[10]);
    ui->title2->setText(SearchedTextList[11]);
    ui->title3->setText(SearchedTextList[12]);
    ui->title4->setText(SearchedTextList[13]);
    ui->title5->setText(SearchedTextList[14]);
    ui->title6->setText(SearchedTextList[15]);
    ui->title7->setText(SearchedTextList[16]);
    ui->title8->setText(SearchedTextList[17]);
    ui->title9->setText(SearchedTextList[18]);
    ui->title10->setText(SearchedTextList[19]);
    getText->close();
}
void MainWindow::CleanFaces()
{
    ui->face1->setPixmap(QPixmap(""));
    ui->face2->setPixmap(QPixmap(""));
    ui->face3->setPixmap(QPixmap(""));
    ui->face4->setPixmap(QPixmap(""));
    ui->face5->setPixmap(QPixmap(""));
    ui->face6->setPixmap(QPixmap(""));
    ui->face7->setPixmap(QPixmap(""));
    ui->face8->setPixmap(QPixmap(""));
    ui->face9->setPixmap(QPixmap(""));
    ui->face10->setPixmap(QPixmap(""));
}
void MainWindow::ReloadSearched(int page)
{
    CleanFaces();
    GotoSearchPage();
    //GetSearchedFace(ui->lineEdit->text(),SearchPage);
    GetSearchedText(ui->lineEdit->text(),page);
    QtConcurrent::run([=](){
        GetSearchedFace(ui->lineEdit->text(),page);
    });
    getSearchedBV(ui->lineEdit->text(),page);
}
void MainWindow::GetSearchedFace(QString key, int page)
{
    QProcess *getface=new QProcess(this);
    QString Page=QString("%1").arg(page);
    QString a="sh Search "+key.simplified()+" "+Page+" pic";
    qDebug()<<a;
    getface->start(a);
    getface->waitForFinished();
    QString SearchedText=getface->readAllStandardOutput();
    SearchedFaceList = SearchedText.split("\n");
        qDebug()<<"https:"+SearchedFaceList[0]<<endl;
        QProcess *getFace=new QProcess(this);
        getFace->start("wget https:"+SearchedFaceList[0]+" -O search1.jpg");
        getFace->waitForFinished();
        ui->face11->setPixmap(QPixmap("search1.jpg"));
        getFace->start("wget https:"+SearchedFaceList[1]+" -O search2.jpg");
        getFace->waitForFinished();
        ui->face12->setPixmap(QPixmap("search2.jpg"));
        getFace->start("wget https:"+SearchedFaceList[2]+" -O search3.jpg");
        getFace->waitForFinished();
        ui->face13->setPixmap(QPixmap("search3.jpg"));
        getFace->start("wget https:"+SearchedFaceList[3]+" -O search4.jpg");
        getFace->waitForFinished();
        ui->face14->setPixmap(QPixmap("search4.jpg"));
        getFace->start("wget https:"+SearchedFaceList[4]+" -O search5.jpg");
        getFace->waitForFinished();
        ui->face15->setPixmap(QPixmap("search5.jpg"));
        getFace->start("wget https:"+SearchedFaceList[5]+" -O search6.jpg");
        getFace->waitForFinished();
        ui->face16->setPixmap(QPixmap("search6.jpg"));
        getFace->start("wget https:"+SearchedFaceList[6]+" -O search7.jpg");
        getFace->waitForFinished();
        ui->face17->setPixmap(QPixmap("search7.jpg"));
        getFace->start("wget https:"+SearchedFaceList[7]+" -O search8.jpg");
        getFace->waitForFinished();
        ui->face18->setPixmap(QPixmap("search8.jpg"));
        getFace->start("wget https:"+SearchedFaceList[8]+" -O search9.jpg");
        getFace->waitForFinished();
        ui->face19->setPixmap(QPixmap("search9.jpg"));
        getFace->start("wget https:"+SearchedFaceList[9]+" -O search10.jpg");
        getFace->waitForFinished();
        ui->face20->setPixmap(QPixmap("search10.jpg"));
        getFace->start("wget https:"+SearchedFaceList[10]+" -O search11.jpg");
        getFace->waitForFinished();
        ui->face1->setPixmap(QPixmap("search11.jpg"));
        getFace->start("wget https:"+SearchedFaceList[11]+" -O search12.jpg");
        getFace->waitForFinished();
        ui->face2->setPixmap(QPixmap("search12.jpg"));
        getFace->start("wget https:"+SearchedFaceList[12]+" -O search13.jpg");
        getFace->waitForFinished();
        ui->face3->setPixmap(QPixmap("search13.jpg"));
        getFace->start("wget https:"+SearchedFaceList[13]+" -O search14.jpg");
        getFace->waitForFinished();
        ui->face4->setPixmap(QPixmap("search14.jpg"));
        getFace->start("wget https:"+SearchedFaceList[14]+" -O search15.jpg");
        getFace->waitForFinished();
        ui->face5->setPixmap(QPixmap("search15.jpg"));
        getFace->start("wget https:"+SearchedFaceList[15]+" -O search16.jpg");
        getFace->waitForFinished();
        ui->face6->setPixmap(QPixmap("search16.jpg"));
        getFace->start("wget https:"+SearchedFaceList[16]+" -O search17.jpg");
        getFace->waitForFinished();
        ui->face7->setPixmap(QPixmap("search17.jpg"));
        getFace->start("wget https:"+SearchedFaceList[17]+" -O search18.jpg");
        getFace->waitForFinished();
        ui->face8->setPixmap(QPixmap("search18.jpg"));
        getFace->start("wget https:"+SearchedFaceList[18]+" -O search19.jpg");
        getFace->waitForFinished();
        ui->face9->setPixmap(QPixmap("search19.jpg"));
        getFace->start("wget https:"+SearchedFaceList[19]+" -O search20.jpg");
        getFace->waitForFinished();
        ui->face10->setPixmap(QPixmap("search20.jpg"));
    getface->close();
}
void MainWindow::getSearchedBV(QString key, int page)
{
    QProcess *getBV=new QProcess(this);
    QString Page=QString("%1").arg(page);
    QString a="sh Search "+key.simplified()+" "+Page+" bvid";
    qDebug()<<a;
    getBV->start(a);
    getBV->waitForFinished();
    QString SearchedText=getBV->readAllStandardOutput();
    SearchedBVList = SearchedText.split("\n");
    search=1;
}

void MainWindow::on_gotoNextPage_clicked(bool checked)
{
    SearchPage++;
    ReloadSearched(SearchPage);
}

void MainWindow::on_gotoLastPage_clicked(bool checked)
{
    if (SearchPage==1)
    {
        QMessageBox::information(NULL,"错误！","这就是第一页了！",QMessageBox::Yes);
    }
    else
    {
        SearchPage--;
        ReloadSearched(SearchPage);
    }
}
